"env_logger 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"git2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2-curl 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)",
"log 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "git2-curl"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "curl 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "glob"
version = "0.1.9"
#![feature(collections, core, io, path, env)]
+extern crate "git2-curl" as git2_curl;
extern crate "rustc-serialize" as rustc_serialize;
extern crate cargo;
extern crate env_logger;
fn execute(flags: Flags, config: &Config) -> CliResult<Option<()>> {
config.shell().set_verbose(flags.flag_verbose);
+ init_git_transports(config);
+
if flags.flag_list {
println!("Installed Commands:");
for command in list_commands().into_iter() {
}
dirs
}
+
+fn init_git_transports(config: &Config) {
+ // Only use a custom transport if a proxy is configured, right now libgit2
+ // doesn't support proxies and we have to use a custom transport in this
+ // case. The custom transport, however, is not as well battle-tested.
+ match cargo::ops::http_proxy(config) {
+ Ok(Some(..)) => {}
+ _ => return
+ }
+
+ let handle = match cargo::ops::http_handle(config) {
+ Ok(handle) => handle,
+ Err(..) => return,
+ };
+
+ // The unsafety of the registration function derives from two aspects:
+ //
+ // 1. This call must be synchronized with all other registration calls as
+ // well as construction of new transports.
+ // 2. The argument is leaked.
+ //
+ // We're clear on point (1) because this is only called at the start of this
+ // binary (we know what the state of the world looks like) and we're mostly
+ // clear on point (2) because we'd only free it after everything is done
+ // anyway
+ unsafe {
+ git2_curl::register(handle);
+ }
+}